// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sysin

import (
	"context"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/frame/g"
)

// StockLiveUpdateFields 修改大盘直播字段过滤
type StockLiveUpdateFields struct {
	Date    string `json:"date"    dc:"日期"`
	Time    int    `json:"time"    dc:"时间"`
	Comment string `json:"comment" dc:"评论"`
	Stocks  string `json:"stocks"  dc:"股票code 逗号连接"`
}

// StockLiveInsertFields 新增大盘直播字段过滤
type StockLiveInsertFields struct {
	Date    string `json:"date"    dc:"日期"`
	Time    int    `json:"time"    dc:"时间"`
	Comment string `json:"comment" dc:"评论"`
	Stocks  string `json:"stocks"  dc:"股票code 逗号连接"`
}

// StockLiveEditInp 修改/新增大盘直播
type StockLiveEditInp struct {
	entity.StockLive
}

func (in *StockLiveEditInp) Filter(ctx context.Context) (err error) {
	// 验证日期
	if err := g.Validator().Rules("required").Data(in.Date).Messages("日期不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	return
}

type StockLiveEditModel struct{}

// StockLiveDeleteInp 删除大盘直播
type StockLiveDeleteInp struct {
	Id interface{} `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *StockLiveDeleteInp) Filter(ctx context.Context) (err error) {
	return
}

type StockLiveDeleteModel struct{}

// StockLiveViewInp 获取指定大盘直播信息
type StockLiveViewInp struct {
	Id int `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *StockLiveViewInp) Filter(ctx context.Context) (err error) {
	return
}

type StockLiveViewModel struct {
	entity.StockLive
}

// StockLiveListInp 获取大盘直播列表
type StockLiveListInp struct {
	form.PageReq
	Id int `json:"id" dc:"id"`
}

func (in *StockLiveListInp) Filter(ctx context.Context) (err error) {
	return
}

type StockLiveListModel struct {
	Id         int         `json:"id"      dc:"id"`
	Date       string      `json:"date"    dc:"日期"`
	Time       int         `json:"time"    dc:"时间"`
	Comment    string      `json:"comment" dc:"评论"`
	Stocks     string      `json:"stocks" dc:"评论"`
	StockItems []StockItem `json:"stock_items" dc:"评论"`
}

type StockItem struct {
	Name          string  `json:"name"`
	ChangePercent float64 `json:"change_percent"`
}

// StockLiveExportModel 导出大盘直播
type StockLiveExportModel struct {
	Id      int    `json:"id"      dc:"id"`
	Date    string `json:"date"    dc:"日期"`
	Time    int    `json:"time"    dc:"时间"`
	Comment string `json:"comment" dc:"评论"`
}
